<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>独一无二的出现次数</title>
</head>
<body>
  <script>
    function fn(arr) {
      var map = new Map()
      arr.forEach(element => {
        if (map.get(element)) {
          var num = map.get(element)
          num++
          map.set(element, num)
        } else {
          map.set(element, 1)
        }
      })
      return new Set(map.values()).size == map.size
    }
    console.log(fn([1, 2, 2, 1, 1, 3]))
  </script>
</body>
</html>